package org.ddd.orderdemo.application.event.center;

import com.google.common.eventbus.AsyncEventBus;
import com.google.common.eventbus.EventBus;

import java.util.concurrent.Executor;
import java.util.concurrent.Executors;

public class EventBusFactory {


    public static EventBus createEventBus() {
        EventBus eventBus = new EventBus(new EventBusExceptionHandler());

        return eventBus;
    }

    private static Executor executor = Executors.newFixedThreadPool(2);
    public static AsyncEventBus createAsyncEventBus() {
        AsyncEventBus eventBus = new AsyncEventBus(executor, new EventBusExceptionHandler());

        return eventBus;
    }

}
